﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.ComponentModel;
using ShareCode.Entity;

namespace ClientAppraise.ViewModels;
public partial class BaseDataGridModel<T> : ObservableValidator where T : BaseBaseEntity
{
    public long Id
    {
        get; set;
    }

    [ObservableProperty]
    private bool isChecked;

    public T? Entity
    {
        get; set;
    }

    private static List<BaseDataGridModel<TT>> GetList<TT>(List<TT> values) where TT : BaseBaseEntity
    {
        var list = new List<BaseDataGridModel<TT>>();

        if (values == default || values.Count < 1)
        {
            return list;
        }

        foreach (var a in values)
        {
            var temp = new BaseDataGridModel<TT>()
            {
                Entity = a,
                Id = a.Id,
            };
            list.Add(temp);
        }

        return list;
    }

}
